package com.heima.consumer.web;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication//(scanBasePackages = {"com.heima.consumer.web","com.heima.cloud"})
@EnableDiscoveryClient
//@EnableFeignClients(basePackages = "com.heima.cloud.clients")
@EnableCircuitBreaker //开启服务熔断
public class ConsumerApplication {
    @Bean
    @LoadBalanced //开启负载均衡,本质是拦截器
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
        System.out.println("-------------消费端启动--------------------");
    }
}

